# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: tinywrkb <tinywrkb@gmail.com>

pkgname=power-profiles-daemon
pkgver=0.9.0
pkgrel=4
pkgdesc='Makes power profiles handling available over D-Bus'
url='https://gitlab.freedesktop.org/hadess/power-profiles-daemon'
license=(GPL3)
arch=(x86_64)
depends=(python upower)
makedepends=(meson)
checkdepends=(python-dbusmock python-isort python-mccabe python-pylint umockdev)
source=(https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/archive/$pkgver/$pkgname-$pkgver.tar.gz
        https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/commit/42b3341b.patch)
b2sums=('e81818ead84fb627eaba2f17ddba57b69b81e07bfa8d159ae73b7448f91dad72bc30ba9b8d91d190ebe1c38e9c227318bfec4eb3cb32aefc2a05134e17df3f47'
        '8439cec80bd5fad861c28a059b6a95349c492163c8c8fb4513e8354911ec807053f0edfce0e94712872355ac3175b43eb1d0ae47b7a0f855f685967bbc0503e2')

prepare() {
  patch -d $pkgname-$pkgver -p1 < 42b3341b.patch # Fix test failure
}

build() {
  meson $pkgname-$pkgver build \
    --prefix /usr \
    --libexec lib
  meson compile -C build
}

check() {
  meson test -C build
}

package() {
  meson install -C build --destdir "$pkgdir"
}
